package com.hourse.app.controller.rms;

import com.hourse.app.entity.CurrencyEntity;
import com.hourse.app.service.ConfigCurrencyService;
import com.hourse.app.vo.rms.CurrencyVo;
import com.hourse.app.vo.web.PublicDealRetVo;
import com.hourse.platform.vo.CreateUserVO;
import com.hourse.platform.vo.PageData;
import com.hourse.platform.vo.ResultMsg;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "后管-币种服务")
@RestController
@RequestMapping("rms/config/currency")
@Slf4j
public class ConfigCurrencyController {

  @Autowired
  private ConfigCurrencyService configCurrencyService;

  @ApiOperation(value = "配置币种-查询")
  @SneakyThrows
  @GetMapping(value = "list")
  public PageData publicDeal() {

    List<Object> list = configCurrencyService.list();

    return new ResultMsg<>(list);
  }

  @ApiOperation(value = "配置币种-新增/编辑")
  @SneakyThrows
  @PostMapping(value = "save")
  public PageData publicDeal(@RequestBody CurrencyVo currencyVo) {

    configCurrencyService.save((CurrencyEntity) currencyVo.bindEnity(CurrencyEntity.class));

    return PageData.New().SUCCESS();
  }

}
